package priv.pront.code.mati.province.comp;

import java.util.Scanner;

/**
 * @Description:
 * @Author: pront
 * @Time:2023-11-18 16:50
 */
public class Main12 {

    static int t;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        t = scanner.nextInt();
        while (t-- > 0) {
            int cnt = 0;
            String s0 = scanner.next();
            String s = scanner.next();
            for (int i = 0; i < s0.length() - s.length(); i++) {
                int alter = 0;
                int k = i;
                for (int j = 0; j < s.length(); j++) {
                    if(s0.charAt(k) != s.charAt(j)){
                        alter++;
                    }
                    k++;
                }
                if(alter <= 3) cnt++;
            }
            System.out.println(cnt);
        }
    }
}
